package com.sdhs.examinemanage.controller;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.core.page.TableDataInfo;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.common.utils.poi.ExcelUtil;
import com.sdhs.examinemanage.domain.GcExamineManage;
import com.sdhs.examinemanage.service.IGcExamineManageService;

/**
 * 项目考核管理Controller
 * 
 * @author wanglei
 * @date 2025-03-27
 */
@RestController
@RequestMapping("/examinemanage/examineManage")
public class GcExamineManageController extends BaseController
{
    @Autowired
    private IGcExamineManageService gcExamineManageService;

    /**
     * 查询项目考核管理列表
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:list')")
    @GetMapping("/list")
    public TableDataInfo list(GcExamineManage gcExamineManage)
    {
        startPage();
        List<GcExamineManage> list = gcExamineManageService.selectGcExamineManageList(gcExamineManage);
        return getDataTable(list);
    }

    /**
     * 导出项目考核管理列表
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:export')")
    @Log(title = "项目考核管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GcExamineManage gcExamineManage)
    {
        List<GcExamineManage> list = gcExamineManageService.selectGcExamineManageList(gcExamineManage);
        ExcelUtil<GcExamineManage> util = new ExcelUtil<GcExamineManage>(GcExamineManage.class);
        util.exportExcel(response, list, "项目考核管理数据");
    }

    /**
     * 获取项目考核管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(gcExamineManageService.selectGcExamineManageById(id));
    }
    
    /**
     * 申诉详情（工程管理中心）
     */
//    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:appealDetailCenter')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(gcExamineManageService.selectGcExamineManageById(id));
//    }
    
    /**
     * 申诉详情（项目经理）
     */
//    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:appealDetailManager')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(gcExamineManageService.selectGcExamineManageById(id));
//    }

    /**
     * 新增项目考核管理
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:add')")
    @Log(title = "项目考核管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GcExamineManage gcExamineManage)
    {
        return toAjax(gcExamineManageService.insertGcExamineManage(gcExamineManage));
    }

    /**
     * 修改项目考核管理
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:edit')")
    @Log(title = "项目考核管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GcExamineManage gcExamineManage)
    {
        return toAjax(gcExamineManageService.updateGcExamineManage(gcExamineManage));
    }
    
    /**
     * 项目考核申诉
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:appeal')")
    @Log(title = "项目考核管理", businessType = BusinessType.UPDATE)
    @PutMapping("/appeal")
    public AjaxResult appeal(@RequestBody GcExamineManage gcExamineManage)
    {
        return toAjax(gcExamineManageService.updateGcExamineManageAppeal(gcExamineManage));
    }
    
    /**
     * 项目考核申诉反馈
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:feedback')")
    @Log(title = "项目考核管理", businessType = BusinessType.UPDATE)
    @PutMapping("/feedback")
    public AjaxResult feedback(@RequestBody GcExamineManage gcExamineManage)
    {
        return toAjax(gcExamineManageService.updateGcExamineManageAppealFeedback(gcExamineManage));
    }

    /**
     * 删除项目考核管理
     */
    @PreAuthorize("@ss.hasPermi('examinemanage:examineManage:remove')")
    @Log(title = "项目考核管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gcExamineManageService.deleteGcExamineManageByIds(ids));
    }
}
